//
//  SettingViewController.m
//  宜居HD
//
//  Created by 张金国 on 16/4/28.
//  Copyright © 2016年 张金国. All rights reserved.
//

#import "SettingViewController.h"
#import "SettingMasterViewController.h"
#import "SettingDetailFunctionViewController.h"
#import "SettingDetailHelpViewController.h"
#import "Macro.h"
#import "SettingDetailNavController.h"

@interface SettingViewController ()

@end

@implementation SettingViewController

- (instancetype)init{
    if (self = [super init]) {
        SettingMasterViewController * masterViewController = [[SettingMasterViewController alloc]init];
        
//        SettingDetailFunctionViewController * detailViewController = [[SettingDetailFunctionViewController alloc]init];
//        SettingDetailNavController *navs = [[SettingDetailNavController alloc] initWithRootViewController:detailViewController];
        
        __weak typeof(self) weakSelf = self;
        
        masterViewController.block = ^(NSString *controllerName){
            NSMutableArray *array = [NSMutableArray arrayWithArray:weakSelf.viewControllers];
            Class clazz = NSClassFromString(controllerName);
            UIViewController *controller = [clazz new];
            SettingDetailNavController *nav = [[SettingDetailNavController alloc] initWithRootViewController:controller];
            array[1] = nav;
            weakSelf.viewControllers = array;
        };
        
        self.viewControllers = @[masterViewController];
        self.maximumPrimaryColumnWidth=0.4*[UIScreen mainScreen].bounds.size.width;
    }
    
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
//    self.view.backgroundColor = [UIColor colorWithRed:0.967 green:0.163 blue:1.000 alpha:1.000];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
